/*
 * Tencent is pleased to support the open source community by making ovCompose available.
 * Copyright (C) 2025 Tencent. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#import "TMMCALayerSaveState.h"

CALayerSaveState CALayerSaveStateCreateSafeGuard(void) {
    CALayerSaveState state;
    memset(&state, 0, sizeof(state));
    state.transform = CATransform3DIdentity;
    state.makeType = CALayerSaveStateMakeTypeSafeGuard;
    return state;
}

NSString *TMMNSStringFromCATransform3D(CATransform3D transform) {
    return [NSString stringWithFormat:@"["
                                      @"\n  [%.2f, %.2f, %.2f, %.2f],"
                                      @"\n  [%.2f, %.2f, %.2f, %.2f],"
                                      @"\n  [%.2f, %.2f, %.2f, %.2f],"
                                      @"\n  [%.2f, %.2f, %.2f, %.2f]"
                                      @"\n]",
                                      transform.m11, transform.m12, transform.m13, transform.m14, transform.m21, transform.m22, transform.m23,
                                      transform.m24, transform.m31, transform.m32, transform.m33, transform.m34, transform.m41, transform.m42,
                                      transform.m43, transform.m44];
}
